#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
    string phone;
    cin >> phone;
    bool a[10];
    for(int i = 0; i<10; i++)
        a[i] = false;
    for(int i = 0; i<phone.size(); i++)
    {
        int num = phone[i] - '0';
        a[num] = true;
    }
    int arr[10];
    int arrLen = 0;
    for(int i = 9; i>=0; i--)
    {
        if(a[i] == true)
        {
            arr[arrLen] = i;
            arrLen++;
        }
    }

    cout << "int[] arr = new int[]{";
    for(int i = 0; i < arrLen-1; i++)
    {
        cout << arr[i] << ",";
    }
    cout << arr[arrLen-1];
    cout << "};\n";

    int index[20];
    int indexLen = 0;
    for(int i = 0; i<phone.size(); i++)
    {
        int num = phone[i] - '0';
        for(int j = 0; j < arrLen; j++)
        {
            if(arr[j] == num)
            {
                index[indexLen] = j;
                indexLen++;
                break;
            }
        }
    }
    cout << "int[] index = new int[]{";
    for(int i = 0; i < indexLen-1; i++)
        cout << index[i] <<",";
    cout<<index[indexLen-1];
    cout << "};";
    
}